package com.jar.exercise.多线程.线程回调;

import java.util.HashMap;
import java.util.Map;

/**
 * 简单的回调机制理解
 */
public class CallBackDemo {

	public static void main(String[] args) {
		CallBackInter callBackInter1 = () -> System.out.println("one");
		CallBackInter callBackInter2= () -> System.out.println("two");
		CallBackInter callBackInter3 = () -> System.out.println("three");
		Map<String, CallBackInter> map = new HashMap<>();
		map.put("one", callBackInter1);
		map.put("two", callBackInter2);
		map.put("three", callBackInter3);
		map.get("one").call();
	}



	public interface CallBackInter {
		void call();
	}
}